AC_INIT(blt.c)
/bin/rm -f config.cache
CC=${CC-gcc}
AC_HAVE_HEADERS(unistd.h)
AC_HAVE_FUNCS(sigaction)

# -----------------------------------------------------------------------
# 	Check for strerror, strdup, strcasecmp.
# -----------------------------------------------------------------------
AC_HAVE_FUNCS(strerror strdup strcasecmp)
AC_SIZE_T

# -----------------------------------------------------------------------
#
# 	Check for header files
#
# -----------------------------------------------------------------------
AC_STDC_HEADERS
AC_HAVE_HEADERS(stdlib.h string.h float.h malloc.h)
AC_HAVE_HEADERS(errno.h unistd.h memory.h limits.h sys/time.h sys/wait.h)
AC_TIME_WITH_SYS_TIME


LOSSAGE=""
#--------------------------------------------------------------------
#	The check below checks whether <sys/wait.h> defines the type
#	"union wait" correctly.  It's needed because of weirdness in
#	HP-UX where "union wait" is defined in both the BSD and SYS-V
#	environments.  Checking the usability of WIFEXITED seems to do
#	the trick.
#--------------------------------------------------------------------

AC_COMPILE_CHECK([union wait], [#include <sys/types.h> 
#include <sys/wait.h>], [
union wait x;
WIFEXITED(x);		/* Generates compiler error if WIFEXITED
			 * uses an int. */
], , [ LOSSAGE="$LOSSAGE -DNO_UNION_WAIT" ])

# -----------------------------------------------------------------------
# 	Check if postscript prolog can be inlined.
# -----------------------------------------------------------------------
echo "checking if postscript prolog can be inlined"
AC_TEST_PROGRAM([
#include "$PWD/src/bltGrPS.h"
int main() { exit(0); }
],, [ LOSSAGE="$LOSSAGE -DNO_INLINE_PROLOG" ])

AC_SUBST(LOSSAGE)
    
# -----------------------------------------------------------------------
#	tcl.h
# -----------------------------------------------------------------------
echo "checking for tcl.h"
TCLINCDIR="../Tcl"
AC_SUBST(TCLINCSW)

# -----------------------------------------------------------------------
# 	tk.h
# -----------------------------------------------------------------------
echo "checking for tk.h"
TKINCDIR="../Tk"
AC_SUBST(TKINCSW)

AC_OUTPUT(Makefile bltConfig.h blt-1.9/src/Makefile)
